Environmental Issues

This script displays information about the current browser.

Discussion

If you're concerned about having your Web pages run with as many JavaScript-enabled browsers as possible, you often need to know more about what browser the user has. MSIE and NN/NC support different features and functions, and different versions within the same browser support different features. For example, NN3.0 and above supports the String.split() function, while NN2.0 and all MSIE versions before 4.0 don't. Missing functionality in an older version might cause you to code something differently to obtain the same results. (The JavaScript Bach piano script is a prime example of this--and so it this script!)

Also, you might be depending on the presence of a plug-in that the user has never downloaded, or on support for a MIME type the user (or the user's Internet service provider) has never heard of. You wouldn't want to continue running the script because you know that there's an error message looming on the user's horizon. By taking stock of the browser environment, you can make sure that you present your scripts and Web pages to the broadest possible audience, and with the greatest available number of features.

Copyright ©2000 by Charles River Media, All Rights Reserved